set number
set cursorline
set wrap
set scrolloff=5
set signcolumn=number
set splitbelow
set splitright
set wildmenu
set showcmd " show tip for visual mode
set laststatus=2 " always display status line
set conceallevel=2
set autochdir
set noswapfile " do not create .swap file
set updatetime=300 " faster completion (4000ms default)
set pumheight=10 " completion pop up menu height
set shortmess+=c
set nobackup
set nowritebackup

" Use 24-bit colors for term
if (has('termguicolors'))
  set termguicolors
endif

" Encoding
set encoding=utf-8
set fileencoding=utf-8
set termencoding=utf-8

" Search
set hlsearch
set incsearch " display pattern while typing search command
set ignorecase
set smartcase " stop ignoring case if type uppercase

" Indentation
set expandtab " convert tabs to spaces
set shiftwidth=2 " the number of spaces inserted for each indentation
set tabstop=2 " insert 2 spaces for a tab
set smartindent " make indenting smarter again

" Fold
set foldlevel=99

" Enable visible chars for special symbol
set list
set listchars=tab:\|\ ,trail:▫

" File type detection
filetype on " enable file type detection
filetype plugin on " load plugin for detected file type
filetype indent on " load indentation rule for detected file type

" Enable syntax highlight
syntax on

" Communicate with system clipboard
" set clipboard+=unnamedplus

" Make the cursor go back to the last place when the file closed
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
